{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "using ForwardDiff, Plots, IntervalRootFinding, IntervalArithmetic\n",
    "import Roots"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "#7 (generic function with 1 method)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# defining the relperm functions\n",
    "krw0 = 0.3\n",
    "kro0 = 0.9\n",
    "nw = 2\n",
    "no = 2\n",
    "sor = 0.2\n",
    "swc = 0.1\n",
    "sw_init = max(0.2, swc)\n",
    "\n",
    "muw = 0.001\n",
    "muo = 0.003\n",
    "\n",
    "krw(sw) = krw0*((sw-swc)/(1-swc-sor))^nw\n",
    "kro(sw) = kro0*((1-sw-sor)/(1-swc-sor))^no\n",
    "\n",
    "fw(sw) = (krw(sw)/muw)/(krw(sw)/muw+kro(sw)/muo)\n",
    "\n",
    "dfw = sw -> ForwardDiff.derivative(fw, sw)\n",
    "\n",
    "fsw_shock = sw -> dfw(sw)-(fw(sw)-fw(sw_init))/(sw-sw_init)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip6000\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2000\" height=\"2000\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6001\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip6001)\" points=\"\n",
       "0,1600 2400,1600 2400,0 0,0 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6002\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip6001)\" points=\"\n",
       "224.386,1440.48 2321.26,1440.48 2321.26,47.2441 224.386,47.2441 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6003\">\n",
       "    <rect x=\"224\" y=\"47\" width=\"2098\" height=\"1394\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  566.329,1440.48 566.329,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1131.52,1440.48 1131.52,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1696.72,1440.48 1696.72,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2261.91,1440.48 2261.91,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,1401.05 2321.26,1401.05 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,1108.97 2321.26,1108.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,816.884 2321.26,816.884 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,524.801 2321.26,524.801 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,232.717 2321.26,232.717 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1440.48 2321.26,1440.48 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1440.48 224.386,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  566.329,1440.48 566.329,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1131.52,1440.48 1131.52,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1696.72,1440.48 1696.72,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2261.91,1440.48 2261.91,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1401.05 255.839,1401.05 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1108.97 255.839,1108.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,816.884 255.839,816.884 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,524.801 255.839,524.801 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,232.717 255.839,232.717 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 566.329, 1494.48)\" x=\"566.329\" y=\"1494.48\">0.2</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 1131.52, 1494.48)\" x=\"1131.52\" y=\"1494.48\">0.4</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 1696.72, 1494.48)\" x=\"1696.72\" y=\"1494.48\">0.6</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 2261.91, 1494.48)\" x=\"2261.91\" y=\"1494.48\">0.8</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 1418.55)\" x=\"200.386\" y=\"1418.55\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 1126.47)\" x=\"200.386\" y=\"1126.47\">0.2</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 834.384)\" x=\"200.386\" y=\"834.384\">0.4</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 542.301)\" x=\"200.386\" y=\"542.301\">0.6</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 250.217)\" x=\"200.386\" y=\"250.217\">0.8</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66; text-anchor:middle;\" transform=\"rotate(0, 1272.82, 1590.4)\" x=\"1272.82\" y=\"1590.4\">Sw</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66; text-anchor:middle;\" transform=\"rotate(-90, 57.6, 743.863)\" x=\"57.6\" y=\"743.863\">kro, krw</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  283.732,1401.05 303.713,1401.01 323.695,1400.87 343.677,1400.65 363.658,1400.34 383.64,1399.93 403.622,1399.44 423.603,1398.86 443.585,1398.19 463.566,1397.43 \n",
       "  483.548,1396.58 503.53,1395.64 523.511,1394.61 543.493,1393.5 563.475,1392.29 583.456,1390.99 603.438,1389.61 623.42,1388.13 643.401,1386.57 663.383,1384.91 \n",
       "  683.365,1383.17 703.346,1381.34 723.328,1379.42 743.309,1377.4 763.291,1375.3 783.273,1373.11 803.254,1370.83 823.236,1368.46 843.218,1366 863.199,1363.46 \n",
       "  883.181,1360.82 903.163,1358.09 923.144,1355.28 943.126,1352.37 963.108,1349.38 983.089,1346.29 1003.07,1343.12 1023.05,1339.85 1043.03,1336.5 1063.02,1333.06 \n",
       "  1083,1329.53 1102.98,1325.91 1122.96,1322.2 1142.94,1318.4 1162.92,1314.51 1182.91,1310.53 1202.89,1306.46 1222.87,1302.3 1242.85,1298.06 1262.83,1293.72 \n",
       "  1282.81,1289.3 1302.8,1284.78 1322.78,1280.18 1342.76,1275.48 1362.74,1270.7 1382.72,1265.83 1402.7,1260.87 1422.69,1255.81 1442.67,1250.67 1462.65,1245.44 \n",
       "  1482.63,1240.12 1502.61,1234.71 1522.59,1229.22 1542.58,1223.63 1562.56,1217.95 1582.54,1212.18 1602.52,1206.33 1622.5,1200.38 1642.48,1194.35 1662.47,1188.22 \n",
       "  1682.45,1182.01 1702.43,1175.71 1722.41,1169.32 1742.39,1162.83 1762.37,1156.26 1782.35,1149.6 1802.34,1142.85 1822.32,1136.01 1842.3,1129.08 1862.28,1122.07 \n",
       "  1882.26,1114.96 1902.24,1107.76 1922.23,1100.47 1942.21,1093.1 1962.19,1085.63 1982.17,1078.08 2002.15,1070.43 2022.13,1062.7 2042.12,1054.88 2062.1,1046.97 \n",
       "  2082.08,1038.96 2102.06,1030.87 2122.04,1022.69 2142.02,1014.42 2162.01,1006.06 2181.99,997.615 2201.97,989.077 2221.95,980.449 2241.93,971.732 2261.91,962.926 \n",
       "  \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6003)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  283.732,86.6754 303.713,113.094 323.695,139.245 343.677,165.128 363.658,190.742 383.64,216.088 403.622,241.166 423.603,265.976 443.585,290.517 463.566,314.79 \n",
       "  483.548,338.795 503.53,362.532 523.511,386.001 543.493,409.201 563.475,432.133 583.456,454.797 603.438,477.193 623.42,499.32 643.401,521.18 663.383,542.771 \n",
       "  683.365,564.094 703.346,585.149 723.328,605.935 743.309,626.453 763.291,646.703 783.273,666.685 803.254,686.399 823.236,705.844 843.218,725.021 863.199,743.93 \n",
       "  883.181,762.571 903.163,780.944 923.144,799.048 943.126,816.884 963.108,834.452 983.089,851.752 1003.07,868.783 1023.05,885.547 1043.03,902.042 1063.02,918.269 \n",
       "  1083,934.227 1102.98,949.918 1122.96,965.34 1142.94,980.494 1162.92,995.38 1182.91,1010 1202.89,1024.35 1222.87,1038.43 1242.85,1052.24 1262.83,1065.79 \n",
       "  1282.81,1079.06 1302.8,1092.07 1322.78,1104.81 1342.76,1117.28 1362.74,1129.49 1382.72,1141.42 1402.7,1153.09 1422.69,1164.49 1442.67,1175.62 1462.65,1186.48 \n",
       "  1482.63,1197.08 1502.61,1207.4 1522.59,1217.46 1542.58,1227.25 1562.56,1236.77 1582.54,1246.02 1602.52,1255.01 1622.5,1263.73 1642.48,1272.18 1662.47,1280.36 \n",
       "  1682.45,1288.27 1702.43,1295.91 1722.41,1303.29 1742.39,1310.4 1762.37,1317.23 1782.35,1323.81 1802.34,1330.11 1822.32,1336.14 1842.3,1341.91 1862.28,1347.41 \n",
       "  1882.26,1352.64 1902.24,1357.6 1922.23,1362.29 1942.21,1366.72 1962.19,1370.88 1982.17,1374.77 2002.15,1378.39 2022.13,1381.74 2042.12,1384.82 2062.1,1387.64 \n",
       "  2082.08,1390.19 2102.06,1392.47 2122.04,1394.48 2142.02,1396.22 2162.01,1397.7 2181.99,1398.91 2201.97,1399.84 2221.95,1400.51 2241.93,1400.92 2261.91,1401.05 \n",
       "  \n",
       "  \"/>\n",
       "<polygon clip-path=\"url(#clip6001)\" points=\"\n",
       "1934.41,312.204 2249.26,312.204 2249.26,130.764 1934.41,130.764 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1934.41,312.204 2249.26,312.204 2249.26,130.764 1934.41,130.764 1934.41,312.204 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1958.41,191.244 2102.41,191.244 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2126.41, 208.744)\" x=\"2126.41\" y=\"208.744\">krw</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6001)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1958.41,251.724 2102.41,251.724 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6001)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2126.41, 269.224)\" x=\"2126.41\" y=\"269.224\">kro</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sw = collect(range(swc, stop=1-sor, length=100))\n",
    "plot(sw, krw.(sw), label=\"krw\")\n",
    "plot!(sw, kro.(sw), label=\"kro\")\n",
    "plot!(xlabel=\"Sw\", ylabel=\"kro, krw\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip6400\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2000\" height=\"2000\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6401\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip6401)\" points=\"\n",
       "0,1600 2400,1600 2400,0 0,0 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6402\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip6401)\" points=\"\n",
       "224.386,1440.48 2321.26,1440.48 2321.26,47.2441 224.386,47.2441 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6403\">\n",
       "    <rect x=\"224\" y=\"47\" width=\"2098\" height=\"1394\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  566.329,1440.48 566.329,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1131.52,1440.48 1131.52,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1696.72,1440.48 1696.72,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2261.91,1440.48 2261.91,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,1401.05 2321.26,1401.05 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,1170.97 2321.26,1170.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,940.879 2321.26,940.879 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,710.793 2321.26,710.793 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,480.706 2321.26,480.706 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  224.386,250.62 2321.26,250.62 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1440.48 2321.26,1440.48 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1440.48 224.386,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  566.329,1440.48 566.329,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1131.52,1440.48 1131.52,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1696.72,1440.48 1696.72,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2261.91,1440.48 2261.91,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1401.05 255.839,1401.05 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,1170.97 255.839,1170.97 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,940.879 255.839,940.879 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,710.793 255.839,710.793 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,480.706 255.839,480.706 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  224.386,250.62 255.839,250.62 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 566.329, 1494.48)\" x=\"566.329\" y=\"1494.48\">0.2</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 1131.52, 1494.48)\" x=\"1131.52\" y=\"1494.48\">0.4</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 1696.72, 1494.48)\" x=\"1696.72\" y=\"1494.48\">0.6</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 2261.91, 1494.48)\" x=\"2261.91\" y=\"1494.48\">0.8</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 1418.55)\" x=\"200.386\" y=\"1418.55\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 1188.47)\" x=\"200.386\" y=\"1188.47\">0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 958.379)\" x=\"200.386\" y=\"958.379\">1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 728.293)\" x=\"200.386\" y=\"728.293\">1.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 498.206)\" x=\"200.386\" y=\"498.206\">2.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 200.386, 268.12)\" x=\"200.386\" y=\"268.12\">2.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66; text-anchor:middle;\" transform=\"rotate(0, 1272.82, 1590.4)\" x=\"1272.82\" y=\"1590.4\">Sw</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66; text-anchor:middle;\" transform=\"rotate(-90, 57.6, 743.863)\" x=\"57.6\" y=\"743.863\">fw, dfw</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  283.732,1401.05 303.713,1401 323.695,1400.86 343.677,1400.6 363.658,1400.24 383.64,1399.75 403.622,1399.14 423.603,1398.4 443.585,1397.52 463.566,1396.5 \n",
       "  483.548,1395.31 503.53,1393.97 523.511,1392.46 543.493,1390.77 563.475,1388.9 583.456,1386.83 603.438,1384.56 623.42,1382.09 643.401,1379.4 663.383,1376.48 \n",
       "  683.365,1373.33 703.346,1369.95 723.328,1366.32 743.309,1362.44 763.291,1358.31 783.273,1353.91 803.254,1349.25 823.236,1344.32 843.218,1339.12 863.199,1333.64 \n",
       "  883.181,1327.89 903.163,1321.87 923.144,1315.58 943.126,1309.02 963.108,1302.19 983.089,1295.11 1003.07,1287.78 1023.05,1280.2 1043.03,1272.4 1063.02,1264.37 \n",
       "  1083,1256.14 1102.98,1247.72 1122.96,1239.12 1142.94,1230.37 1162.92,1221.47 1182.91,1212.46 1202.89,1203.34 1222.87,1194.15 1242.85,1184.9 1262.83,1175.61 \n",
       "  1282.81,1166.32 1302.8,1157.03 1322.78,1147.78 1342.76,1138.59 1362.74,1129.47 1382.72,1120.46 1402.7,1111.56 1422.69,1102.81 1442.67,1094.21 1462.65,1085.79 \n",
       "  1482.63,1077.56 1502.61,1069.53 1522.59,1061.73 1542.58,1054.15 1562.56,1046.82 1582.54,1039.74 1602.52,1032.91 1622.5,1026.35 1642.48,1020.06 1662.47,1014.04 \n",
       "  1682.45,1008.29 1702.43,1002.81 1722.41,997.612 1742.39,992.682 1762.37,988.02 1782.35,983.624 1802.34,979.488 1822.32,975.609 1842.3,971.98 1862.28,968.596 \n",
       "  1882.26,965.45 1902.24,962.534 1922.23,959.842 1942.21,957.367 1962.19,955.099 1982.17,953.033 2002.15,951.159 2022.13,949.47 2042.12,947.958 2062.1,946.616 \n",
       "  2082.08,945.435 2102.06,944.408 2122.04,943.528 2142.02,942.786 2162.01,942.177 2181.99,941.693 2201.97,941.328 2221.95,941.074 2241.93,940.927 2261.91,940.879 \n",
       "  \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6403)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  283.732,1401.05 303.713,1387.36 323.695,1372.84 343.677,1357.44 363.658,1341.14 383.64,1323.92 403.622,1305.72 423.603,1286.54 443.585,1266.34 463.566,1245.1 \n",
       "  483.548,1222.79 503.53,1199.4 523.511,1174.91 543.493,1149.31 563.475,1122.6 583.456,1094.78 603.438,1065.84 623.42,1035.81 643.401,1004.71 663.383,972.557 \n",
       "  683.365,939.401 703.346,905.286 723.328,870.272 743.309,834.428 763.291,797.837 783.273,760.59 803.254,722.796 823.236,684.572 843.218,646.05 863.199,607.374 \n",
       "  883.181,568.699 903.163,530.194 923.144,492.035 943.126,454.411 963.108,417.518 983.089,381.558 1003.07,346.739 1023.05,313.272 1043.03,281.367 1063.02,251.233 \n",
       "  1083,223.075 1102.98,197.09 1122.96,173.466 1142.94,152.377 1162.92,133.984 1182.91,118.427 1202.89,105.829 1222.87,96.2914 1242.85,89.8894 1262.83,86.6754 \n",
       "  1282.81,86.6754 1302.8,89.8894 1322.78,96.2914 1342.76,105.829 1362.74,118.427 1382.72,133.984 1402.7,152.377 1422.69,173.466 1442.67,197.09 1462.65,223.075 \n",
       "  1482.63,251.233 1502.61,281.367 1522.59,313.272 1542.58,346.739 1562.56,381.558 1582.54,417.518 1602.52,454.411 1622.5,492.035 1642.48,530.194 1662.47,568.699 \n",
       "  1682.45,607.374 1702.43,646.05 1722.41,684.572 1742.39,722.796 1762.37,760.59 1782.35,797.837 1802.34,834.428 1822.32,870.272 1842.3,905.286 1862.28,939.401 \n",
       "  1882.26,972.557 1902.24,1004.71 1922.23,1035.81 1942.21,1065.84 1962.19,1094.78 1982.17,1122.6 2002.15,1149.31 2022.13,1174.91 2042.12,1199.4 2062.1,1222.79 \n",
       "  2082.08,1245.1 2102.06,1266.34 2122.04,1286.54 2142.02,1305.72 2162.01,1323.92 2181.99,1341.14 2201.97,1357.44 2221.95,1372.84 2241.93,1387.36 2261.91,1401.05 \n",
       "  \n",
       "  \"/>\n",
       "<polygon clip-path=\"url(#clip6401)\" points=\"\n",
       "1934.36,312.204 2249.26,312.204 2249.26,130.764 1934.36,130.764 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1934.36,312.204 2249.26,312.204 2249.26,130.764 1934.36,130.764 1934.36,312.204 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1958.36,191.244 2102.36,191.244 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2126.36, 208.744)\" x=\"2126.36\" y=\"208.744\">fw</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6401)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1958.36,251.724 2102.36,251.724 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6401)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2126.36, 269.224)\" x=\"2126.36\" y=\"269.224\">dfw</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(xlabel=\"Sw\", ylabel = \"fw, dfw\")\n",
    "plot!(sw, [fw.(sw) dfw.(sw)], label = [\"fw\", \"dfw\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5621627686929838"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# test the rootfinding\n",
    "rts = Roots.find_zeros(fsw_shock, swc, 1-sor)\n",
    "sw_shock = maximum(rts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip6600\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2000\" height=\"2000\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6601\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip6601)\" points=\"\n",
       "0,1600 2400,1600 2400,0 0,0 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6602\">\n",
       "    <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip6601)\" points=\"\n",
       "251.149,1440.48 2321.26,1440.48 2321.26,47.2441 251.149,47.2441 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip6603\">\n",
       "    <rect x=\"251\" y=\"47\" width=\"2071\" height=\"1394\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  588.727,1440.48 588.727,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1146.71,1440.48 1146.71,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  1704.69,1440.48 1704.69,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  2262.67,1440.48 2262.67,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  251.149,1401.05 2321.26,1401.05 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  251.149,1072.46 2321.26,1072.46 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  251.149,743.863 2321.26,743.863 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  251.149,415.269 2321.26,415.269 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  251.149,86.6754 2321.26,86.6754 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,1440.48 2321.26,1440.48 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,1440.48 251.149,47.2441 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  588.727,1440.48 588.727,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1146.71,1440.48 1146.71,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1704.69,1440.48 1704.69,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  2262.67,1440.48 2262.67,1419.58 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,1401.05 282.2,1401.05 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,1072.46 282.2,1072.46 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,743.863 282.2,743.863 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,415.269 282.2,415.269 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  251.149,86.6754 282.2,86.6754 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 588.727, 1494.48)\" x=\"588.727\" y=\"1494.48\">0.2</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 1146.71, 1494.48)\" x=\"1146.71\" y=\"1494.48\">0.4</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 1704.69, 1494.48)\" x=\"1704.69\" y=\"1494.48\">0.6</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:middle;\" transform=\"rotate(0, 2262.67, 1494.48)\" x=\"2262.67\" y=\"1494.48\">0.8</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 227.149, 1418.55)\" x=\"227.149\" y=\"1418.55\">0.00</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 227.149, 1089.96)\" x=\"227.149\" y=\"1089.96\">0.25</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 227.149, 761.363)\" x=\"227.149\" y=\"761.363\">0.50</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 227.149, 432.769)\" x=\"227.149\" y=\"432.769\">0.75</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:end;\" transform=\"rotate(0, 227.149, 104.175)\" x=\"227.149\" y=\"104.175\">1.00</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66; text-anchor:middle;\" transform=\"rotate(0, 1286.2, 1590.4)\" x=\"1286.2\" y=\"1590.4\">Sw</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:66; text-anchor:middle;\" transform=\"rotate(-90, 57.6, 743.863)\" x=\"57.6\" y=\"743.863\">fw</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  309.737,1401.05 329.463,1400.91 349.19,1400.49 368.916,1399.77 388.643,1398.73 408.37,1397.34 428.096,1395.6 447.823,1393.49 467.55,1390.97 487.276,1388.04 \n",
       "  507.003,1384.66 526.729,1380.83 546.456,1376.51 566.183,1371.69 585.909,1366.34 605.636,1360.43 625.362,1353.96 645.089,1346.89 664.816,1339.2 684.542,1330.87 \n",
       "  704.269,1321.88 723.996,1312.22 743.722,1301.85 763.449,1290.77 783.175,1278.96 802.902,1266.4 822.629,1253.09 842.355,1239 862.082,1224.15 881.808,1208.51 \n",
       "  901.535,1192.09 921.262,1174.89 940.988,1156.92 960.715,1138.18 980.442,1118.68 1000.17,1098.46 1019.89,1077.51 1039.62,1055.88 1059.35,1033.59 1079.07,1010.67 \n",
       "  1098.8,987.156 1118.53,963.1 1138.25,938.542 1157.98,913.533 1177.71,888.124 1197.43,862.373 1217.16,836.337 1236.89,810.077 1256.61,783.656 1276.34,757.139 \n",
       "  1296.07,730.588 1315.79,704.07 1335.52,677.65 1355.25,651.39 1374.97,625.354 1394.7,599.603 1414.43,574.194 1434.15,549.185 1453.88,524.627 1473.61,500.571 \n",
       "  1493.33,477.061 1513.06,454.141 1532.79,431.847 1552.51,410.214 1572.24,389.271 1591.97,369.043 1611.69,349.551 1631.42,330.811 1651.15,312.837 1670.87,295.638 \n",
       "  1690.6,279.219 1710.33,263.58 1730.05,248.722 1749.78,234.638 1769.51,221.323 1789.23,208.765 1808.96,196.954 1828.69,185.874 1848.41,175.509 1868.14,165.843 \n",
       "  1887.87,156.856 1907.59,148.528 1927.32,140.84 1947.05,133.768 1966.77,127.293 1986.5,121.39 2006.23,116.038 2025.95,111.214 2045.68,106.897 2065.41,103.062 \n",
       "  2085.13,99.689 2104.86,96.7557 2124.59,94.2408 2144.31,92.1236 2164.04,90.3837 2183.77,89.0014 2203.49,87.9577 2223.22,87.2339 2242.95,86.8122 2262.67,86.6754 \n",
       "  \n",
       "  \"/>\n",
       "<circle clip-path=\"url(#clip6603)\" style=\"fill:#000000; stroke:none; fill-opacity:1\" cx=\"1599.13\" cy=\"361.881\" r=\"18\"/>\n",
       "<circle clip-path=\"url(#clip6603)\" style=\"fill:#e26f46; stroke:none; fill-opacity:1\" cx=\"1599.13\" cy=\"361.881\" r=\"14\"/>\n",
       "<polyline clip-path=\"url(#clip6603)\" style=\"stroke:#3da44d; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  588.727,1365.53 1599.13,361.881 \n",
       "  \"/>\n",
       "<polygon clip-path=\"url(#clip6601)\" points=\"\n",
       "1958.43,372.684 2249.26,372.684 2249.26,130.764 1958.43,130.764 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1958.43,372.684 2249.26,372.684 2249.26,130.764 1958.43,130.764 1958.43,372.684 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1982.43,191.244 2126.43,191.244 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2150.43, 208.744)\" x=\"2150.43\" y=\"208.744\">y1</text>\n",
       "</g>\n",
       "<circle clip-path=\"url(#clip6601)\" style=\"fill:#000000; stroke:none; fill-opacity:1\" cx=\"2066.43\" cy=\"251.724\" r=\"25\"/>\n",
       "<circle clip-path=\"url(#clip6601)\" style=\"fill:#e26f46; stroke:none; fill-opacity:1\" cx=\"2066.43\" cy=\"251.724\" r=\"21\"/>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2150.43, 269.224)\" x=\"2150.43\" y=\"269.224\">y2</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip6601)\" style=\"stroke:#3da44d; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
       "  1982.43,312.204 2126.43,312.204 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip6601)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48; text-anchor:start;\" transform=\"rotate(0, 2150.43, 329.704)\" x=\"2150.43\" y=\"329.704\">y3</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plot(xlabel = \"Sw\", ylabel = \"fw\")\n",
    "plot!(sw, fw.(sw))\n",
    "scatter!([sw_shock], [fw(sw_shock)])\n",
    "plot!([sw_init, sw_shock], fw.([sw_init, sw_shock]))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 1.0.0",
   "language": "julia",
   "name": "julia-1.0"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.0.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
